/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

var form;

//Called when the page loads
function onLoad()
{ //On load make the div with id=0 visible
    document.getElementById(0).setAttribute("class","contact active");
}

//Called whenever next or previous or submit is pressed
function onSubmit(sectionNumber,next)
{
    // // // Hiding/Displaying the Right Section\\ \\ \\
    var nextSectionNumber = sectionNumber;
    if(next) //Pressed Next
        nextSectionNumber++;
    else //Pressed Previous
        nextSectionNumber--;
    
    if(nextSectionNumber>=0 && nextSectionNumber<8)
    { //Press something that took them out of bounds
        document.getElementById(nextSectionNumber).setAttribute("class","contact active");;
        document.getElementById(sectionNumber).setAttribute("class","contact gone");;
        
        if(nextSectionNumber===7)
        { //This page should have Submit instead of Next
            var inputs = document.body.getElementsByTagName("input");
            inputs[inputs.length-2].setAttribute("value","Submit");
        }
    }
    else if(nextSectionNumber>=8) //Pressed Submit
        document.getElementById("form").submit();
    // // //-------------------------------------\\ \\ \\
    return false;
}

//Takes the id of an input and
//sets the max value accordingly
function setMax(id)
{
    var inputTag = document.getElementById(id);
    id = id.toLowerCase();
    switch(id)
    {
        case "":
            inputTag.setAttribute("max",2);
            return 2;
            break;
        default:
            inputTag.setAttribute("max",1);
            return 1;
            break;
    }
}